package com.umanji.usedmarket.service;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

// import com.umanji.user.dao.UserDao;
import com.umanji.generic.service.GenericService;
import com.umanji.usedmarket.domain.UsedProducts;

@Service("usedProductService")
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true)
public class UsedProductServiceImpl extends GenericService<UsedProducts, Long>
		implements UsedProductService {

	private final Log log = LogFactory.getLog(UsedProductServiceImpl.class);
	

	@Override
	public List find(String productName) {
		
		return em.createQuery(
				"Select t from " + UsedProducts.class.getSimpleName()
						+ " t where product_name = :productName").setParameter(
				"productName", productName).getResultList();
	}

}
